
import 'package:flustars/flustars.dart';
import 'package:smart_freezer/core/utils/logs.dart';

class LocalStorage {

  // static void clearAllData() {
  //
  // }

  /// 记住账号
  static void setAccount(String value) {
    SpUtil.putString("account", value);
  }
  /// 记住账号
  static String getAccount() {
    return SpUtil.getString("account", defValue: "")!;
  }
  /// 记住密码
  static void setPassword(String value) {
    SpUtil.putString("password", value);
  }
  /// 记住密码
  static String getPassword() {
    return SpUtil.getString("password", defValue: "")!;
  }

  static void setToken(String value) {
    SpUtil.putString("token", value);
  }
  static String getToken() {
    return SpUtil.getString("token", defValue: "")!;
  }
  /// 角色: 1-厨师, 2-技术人员, 3-工程经理
  static void setRole(String value) {
    SpUtil.putString("role", value);
  }
  /// 角色: 1-厨师, 2-技术人员, 3-工程经理
  static String getRole() {
    return SpUtil.getString("role", defValue: "")!;
  }
  static void setIsLogin(bool value) {
    SpUtil.putBool("isLogin", value);
  }
  static bool getIsLogin() {
    return SpUtil.getBool("isLogin", defValue: false)!;
  }
  static void setLanguage(int value) {
    SpUtil.putInt("language_key", value);
  }

  /// 1简中, 2繁中, 3英语
  static int getLanguageValue() {
    return SpUtil.getInt("language_key") ?? 1;
  }

  /// 黑白模式: 1暗黑模式 2跟随系统
  static void setThemeMode(int value) {
    SpUtil.putInt("theme_mode", value);
  }
  /// 黑白模式: 1暗黑模式 2跟随系统
  static int getThemeMode() {
    // logs("黑白模式: ${SpUtil.getInt("theme_mode", defValue: 2)}");
    return SpUtil.getInt("theme_mode", defValue: 2) ?? 2;
  }

  /// 极光推送ID
  static void setRegisterID(String value) {
    SpUtil.putString("registerID", value);
  }
  /// 极光推送ID
  static String getRegisterID() {
    return SpUtil.getString("registerID", defValue: "")!;
  }

  /// 涂鸦用户ID
  static void setTyUID(String value) {
    SpUtil.putString("tyUID", value);
  }
  /// 涂鸦用户ID
  static String getTyUID() {
    return SpUtil.getString("tyUID", defValue: "")!;
  }

  /// 国家ID
  static void setCountryCode(String value) {
    SpUtil.putString("CountryCode", value);
  }
  /// 国家ID
  static String getCountryCode() {
    return SpUtil.getString("CountryCode", defValue: "86")!;
  }

  /// 涂鸦分享ID
  static void setWilliamShareID(String value) {
    SpUtil.putString("WilliamShareID", value);
  }
  /// 涂鸦分享ID
  static String getWilliamShareID() {
    return SpUtil.getString("WilliamShareID", defValue: "")!;
  }

  /// 是否查看过协议
  static void setIsCheckAgreement(bool value) {
    SpUtil.putBool("IsCheckAgreement", value);
  }
  /// 是否查看过协议
  static bool getIsCheckAgreement() {
    return SpUtil.getBool("IsCheckAgreement", defValue: false)!;
  }








}